const webpack = require("webpack");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const {
  merge
} = require("webpack-merge");
const webpackBaseConfig = require("./webpack.base.config.js");
const VueLoaderPlugin = require("vue-loader/lib/plugin");

module.exports = merge(webpackBaseConfig, {
  mode: "development",
  devtool: "#source-map",
  module: {
    rules: [
      // 处理css
      {
        test: /\.css$/i,
        use: ["vue-style-loader", "css-loader"],
      },
      // 处理less
      {
        test: /\.less$/i,
        use: ["vue-style-loader", "css-loader", "less-loader"],
      },
      // 处理scss
      {
        test: /\.scss$/i,
        use: ["vue-style-loader", "css-loader", "sass-loader"],
      },
    ],
  },
  plugins: [
    new HtmlWebpackPlugin({
      template: "./index.html",
      favicon: "./icon.ico",
      inject: true,
    }),
    new VueLoaderPlugin(),
  ],
  devServer: {
    port: 8000,
    proxy: {
      '/api/v1': {
        target: 'https://live.xxximmerse.net',
      },
    }
  },
});